#include<bits/stdc++.h>
#define ll long long
using namespace std;

const int N = 8000 + 10;
ll n, q, x, v;
struct num{
	ll val, idx;
} a[N], b[N];

bool cmp(num aa, num bb){
	if(aa.val == bb.val)	return aa.idx < bb.idx;
	return aa.val < bb.val;
}

int main(){
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%lld%lld", &n, &q);
	for(ll i=1;i<=n;i++){
		scanf("%lld", &a[i].val);
		a[i].idx = i;
	}
	sort(a + 1, a + 1 + n, cmp);
	while(q--){
		ll op;
		scanf("%lld", &op);
		if(op == 1){
			ll xx;
			scanf("%lld%lld", &x, &v);
			for(ll i=1;i<=n;i++)	if(a[i].idx == x){xx = i, a[xx].val = v;break;}
			sort(a + 1, a + 1 + n, cmp);
		}else if(op == 2){
			scanf("%lld", &x);
			for(ll i=1;i<=n;i++){
				if(a[i].idx == x){
					printf("%d\n", i);
					break;
				}
			}
		}
	}
	return 0;
}
